package com.android.nfctouch.ui.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.android.baselibrary.interface_.OkHttpCallBack;
import com.android.baselibrary.responce.BaseResponce;
import com.android.baselibrary.tool.CommToast;
import com.android.baselibrary.view.Comm_EditView;
import com.android.baselibrary.view.Comm_HeadView;
import com.android.baselibrary.view.MultiStateView;
import com.android.nfctouch.R;
import com.android.nfctouch.constants.Constants;
import com.android.nfctouch.manager.API_Manager;

import butterknife.BindView;
import butterknife.OnClick;

public class BindActivationCodeActivity extends BaseActivity {

    @BindView(R.id.multiplestatusView)
    MultiStateView multiplestatusView;
    @BindView(R.id.comm_title)
    Comm_HeadView comm_title;
    @BindView(R.id.et_content)
    Comm_EditView et_content;


    @Override
    protected int getLayoutId() {
        return R.layout.activity_bind_activation_code;
    }

    @Override
    protected void initView() {
        comm_title.setTitle("绑定激活码");
    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.tv_submit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_submit:
                String text = et_content.getText();
                if (TextUtils.isEmpty(text)) {
                    CommToast.showToast(mContext, "请输入激活码");
                    return;
                }
                API_Manager.bind_activationCode(mContext, text, new OkHttpCallBack<BaseResponce<String>>() {
                    @Override
                    public void onSuccess(BaseResponce<String> baseResponce) {
                        CommToast.showToast(mContext, "绑定成功");
                        finish();
                    }

                    @Override
                    public void onFailure(BaseResponce<String> baseResponce) {
                        CommToast.showToast(mContext, baseResponce.msg);
                    }
                });
                break;
        }
    }

}
